// components/me/me.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    keys: [[1, 2, 3], [4, 5, 6], [7, 8, 9], [0, '.', -1]],
    money: '0'
  },

  

  /**
   * 组件的方法列表
   */
  methods: {
    
    keyClick: function(e){
      let newMoney = this.data.money
      var key = e.currentTarget.dataset.key
      if (key == -1){
        newMoney = newMoney.substring(0, newMoney.length - 1)
        if (newMoney.length == 0) {
          newMoney = '0'
        }
      }else if (key == '.'){
        if (newMoney.indexOf('.') == -1){
          newMoney += key
        }
      } else{
        if (newMoney == '0'){
          newMoney = key + ''
        }else{
          newMoney += key
        }
      }
      
      
      
      this.setData({
        money: newMoney
      })
    },

     openBillCollect: function (e) {
      wx.navigateTo({
        url: '/pages/collectingBill/collectingBill?money=' + this.data.money + '&userId=' + this.data.userId
      })
    },

  }
})
